using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class updateInfo : System.Web.UI.Page
{
	MembershipUser currentUser = null;
    protected void Page_Load(object sender, EventArgs e)
    {

		currentUser = Membership.GetUser();
		if (!Page.IsPostBack)
		{
			this.UserNameText.Text = currentUser.UserName;
			this.EmailText.Text = currentUser.Email;
			this.PasswordQuestion.Text = currentUser.PasswordQuestion;
		}
    }

	protected void OnUpdateUserClick(object sender, EventArgs e)
	{
		currentUser.Email = EmailText.Text;

		Membership.UpdateUser(currentUser);

		if (PasswordQuestion.Text != currentUser.PasswordQuestion || PasswordAnswer.Text.Length > 0)
		{
			// password question has changed.
			currentUser.ChangePasswordQuestionAndAnswer(PasswordText.Text, PasswordQuestion.Text, PasswordAnswer.Text);
		}
	}
}
